#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll LLMAX = 0x7fffffffffffffff;
struct gd { 
    ll a, b;
    bool operator < (const gd &x) { 
        if (a ^ x.a) return a < x.a;
        else return b < x.b;
    }
} g[2333];
ll n, m, suma[2333], sumb[2333];
int main() { 
  freopen("in", "r", stdin);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) { 
    cin >> g[i].a >> g[i].b;
    suma[i] = suma[i - 1] + g[i].a;
    sumb[i] = sumb[i - 1] + g[i].b;
  }
  sort(g + 1, g + n + 1);
  for (int i = 1; i <= n; i++) { 
    printf("%d: %lld %lld\n", i, g[i].a, g[i].b);
  }
  for (int i = 1; i <= m; i++) { 
    ll tmp;
    cin >> tmp;
    
  }
}
